﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media.Imaging;
using VoiceMessager.Properties;

namespace VoiceMessager.Converter
{
    public class SendstateConverter:IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null) return Resources.shield_error.ToBitmapImage();
            var x = (SendState) value;
            switch (x)
            {
                case SendState.Pending:
                    return Resources.box_full.ToBitmapImage();
                case SendState.Sent:
                    return Resources.box_out.ToBitmapImage();
                case SendState.Recived:
                    return Resources.box_in.ToBitmapImage();
                case SendState.Fail:
                    break;
                default:
                    return Resources.box_void.ToBitmapImage();
            }
            return Resources.shield_error.ToBitmapImage();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
